using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using CommunityToolkit.WinUI;
using Microsoft.UI.Xaml.Media.Imaging;
using Windows.Storage.Search;
using WeGet;
using CommunityToolkit.WinUI.Controls;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace WeAppsCenter.Controls
{
    public sealed partial class ChannelPresenterContent : UserControl
    {
        public string ChannelIdentity {  get; }
        public Channel ChannelName { get; }
        public ChannelPresenterContent(string channelName, string ChannelIcon, string channelIdentity)
        {
            this.InitializeComponent();
            ChannelIdentity = channelIdentity;
            Name.Text = channelName;
            if (channelName=="Publish")
            {
                ChannelName = Channel.Publish;
            }
            else if (channelName=="Preview")
            {
                ChannelName = Channel.Preview;
            }
            BitmapImage bitmapImage = new BitmapImage();
           
            bitmapImage.UriSource = new Uri($"{Core.Settings.DataDirectory.Replace("\\", "/")}/check-for-updates/{ChannelIcon}");
            Icon.Source = bitmapImage;
        }
    }
    public sealed class ChannelPresenter : SegmentedItem
    {
        public ChannelPresenter(string ChannelName, string ChannelIcon, string ChannelIdentity)
        {
            this.Content = new ChannelPresenterContent(ChannelName,ChannelIcon,ChannelIdentity);
        }
    }

}
